package com.zzx.schoolfellow.controller;

import com.zzx.schoolfellow.model.entity.ChatMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;

/**
 * @program: schoolfeoolw_backend
 * @description:
 * @author: zzx
 * @create: 2023-03-26 20:51
 **/
@Controller
public class WebSocketChatController {
//     private SimpMessagingTemplate messagingTemplate;

//     @Autowired
//     public WebSocketChatController(SimpMessagingTemplate messagingTemplate) {
//         this.messagingTemplate = messagingTemplate;
//     }
//
//     @MessageMapping("/chat")
//     public void sendMessage(@Payload ChatMessage chatMessage) {
//         messagingTemplate.convertAndSendToUser(chatMessage.getReceiver(),
//                 "/queue/messages", chatMessage);
//     }
}
